package com.chen.demofeigncalled.controller;

import com.chen.common.dto.ResponseResult;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

@RestController
@RequestMapping("/feigncalled")
public class TestFeignCalledController {

    @RequestMapping("/demo")
    public ResponseResult test1() {
        ArrayList<String> list = new ArrayList<>();
        list.add("22");
        list.add("33");
        list.add("44");
        ResponseResult result = new ResponseResult();
        result.setData(list);
        System.out.println("---------diaoyng -------");
        result.setMessage("成功");
        return result;
    }

    /**
     *  如果方法需要传参数， 需要 加上 @RequestBody   注解
     * @param request
     * @return
     */
    @RequestMapping(value = "/demo1",method = RequestMethod.POST)
    public ResponseResult test2(@RequestBody String request) {
        ArrayList<String> list = new ArrayList<>();
        list.add("22");
        list.add("33");
        list.add("44");
        list.add(request);
        ResponseResult result = new ResponseResult();
        result.setData(list);
        result.setMessage("成功");
        System.out.println("---------diaoyng -------");
        return result;
    }
}
